Skip to content

fix: verify Svix signatures before forwarding webhook payloads#224

Draft
bukinoshita wants to merge 1 commit intomainfrom
fix/verify-webhook-signatures-2e75
Draft

fix: verify Svix signatures before forwarding webhook payloads#224
bukinoshita wants to merge 1 commit intomainfrom
fix/verify-webhook-signatures-2e75

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Verify Svix signatures in the resend webhooks listen flow before forwarding to local targets, preventing spoofed webhook payloads. Fixes BU-646.

  • Bug Fixes
    • Verify using the captured signing_secret from resend.webhooks.create() via resend.webhooks.verify() with the raw body and Svix headers.
    • On failure, return 401 and do not forward; in JSON mode, emit { "error": "signature_verification_failed" }.
    • Add --insecure-forward to skip verification (debug only) with a clear warning banner.
    • Add tests for valid/invalid signatures, bypass mode, JSON output, and no-forward-on-failure.

Written for commit edd9625. Summary will update on new commits.

- Capture signing_secret from resend.webhooks.create() response
- Add verifyPayload() that calls resend.webhooks.verify() with the
  signing secret before forwarding traffic to the local target
- Reject unverified requests with 401 instead of blindly forwarding
- Add --insecure-forward flag to explicitly skip verification
- Display warning banner when --insecure-forward is active
- Add comprehensive tests for signature verification behavior

Fixes BU-646

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants